package com.example.monthmoni.controller;

import com.example.monthmoni.domain.Menu;
import com.example.monthmoni.service.MenuService;
import jakarta.annotation.Resource;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author 宋伟宁
 * @Date 2023/11/28
 * @Version 1.0
 **/
@RestController
public class MenuController {

    @Resource
    private MenuService menuService;
    @GetMapping("/sys/menus")
    @PreAuthorize("hasAuthority('sys:menu:list')")
    public List<Menu> findMenuList() {
        return this.menuService.list();
    }

    @GetMapping("/sys/menu/save")
    @PreAuthorize("hasAuthority('sys:menu:save')")
    public String save() {
        return "新增菜单";
    }

    @GetMapping("/sys/menu/delete")
    @PreAuthorize("hasAuthority('sys:menu:delete')")
    public String delte() {
        return "删除菜单";
    }

}
